#!/bin/sh
# init.d.sh.in
# (C) 2017, all rights reserved,
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

### BEGIN INIT INFO
# Provides:          @PACKAGE_NAME@d
# Required-Start:    $local_fs $remote_fs $syslog $network $named $time
# Required-Stop:     $local_fs $remote_fs $syslog $network $named $time
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: @PACKAGE_NAME_LONG@ daemon processes
### END INIT INFO

set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/@PACKAGE_NAME@d

if [ ! -x "$DAEMON" ]
then
    echo "$0: $DAEMON: not executable"
    exit 1
fi

case "$1" in
    start)
        "$DAEMON" --init-start
        exit 0
        ;;
    stop)
        "$DAEMON" --init-stop
        exit 0
        ;;
    restart|reload|force-reload)
        "$DAEMON" --init-stop
        "$DAEMON" --init-start
        exit 0
        ;;
    *)
        echo "usage: $0 {start|stop|restart|reload|force-reload}" 2>&1
        exit 1
        ;;
esac

